<template>
	<view class="app">
		<!-- <s-navbar position="left">
			<view slot="content">星橘联动</view>
		</s-navbar> -->
		<Page :items="items" ref="ic" />
	</view>
</template>

<script>
	import Page from '@/pages/index/page.vue';
	export default {
		//
		name: 'index',
		//
		components: {
			Page
		},
		//
		data() {
			return {
				options: {},
				//页面元素
				items: {},
				//显示查询对象
				search: {
					name: 'search'
				},
				//显示游戏对象
				category: {
					name: 'category'
				},
				//显示媒体对象
				media: {
					name: 'media'
				}
			};
		},
		//
		onLoad(options) {
			this.options = options;
			
			//todo用户从分享页面进入的处理逻辑
			/**
			 * 异步处理
			 * 1.判断用户是否被绑定
			 * 2.如果没有绑定才进行绑定动作
			 */
			console.log('this.options: ',this.options);
		},
		//
		onShow() {
			this.getPageData();
		},
		//
		// #ifdef MP-WEIXIN
		onShareAppMessage(res) {
			const app = this;
			/**
			 * 挂每个人的id就可以了
			 */
			return {
				title: app.$settings.name,
				path: '/pages/index/index?userId=123',
				imageUrl: '/static/logo.jpg'
			}
		},
		// #endif
		//
		methods: {
			//
			getPageData() {
				this.items = {
					search: this.search,
					category: this.category,
					media: this.media
				};
			}
		}
	};
</script>

<style lang="scss" scoped>
.app{
	background-color: $uni-bg-color-grey;
}	
</style>